/*
 * Copyright(c) 2020-2100 万达信息股份有限公司 版权所有
 * WONDERS INFORMATION CO., LTD. ALL RIGHTS RESERVED.
 */

package com.wondersgroup.controller;

import com.wondersgroup.entity.Product;
import com.wondersgroup.feignclients.ProductClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author: huym
 * @version: 1.0
 * @date: 2020/11/19
 */
@RestController
public class UserController {

    @Autowired
    private ProductClient productClient;

    @GetMapping("/user/showProductMsg")
    public String showProductMsg(){
        return productClient.showMsg();
    }

    @GetMapping("/user/findOne")
    public Map<String, Object> findOne(String productId){
        return productClient.findOne(productId);
    }

    @GetMapping("/user/save")
    public Map<String, Object> save(String name){
        return productClient.save(name);
    }

    @PostMapping("/user/saveProduct")
    public Map<String, Object> saveProduct(@RequestBody Product product){
        return productClient.saveProduct(product);
    }

    @RequestMapping("/user/complex")
    public  Map<String,Object> complex(@RequestBody Product product, @RequestParam String name){
        return productClient.complex(product, name);
    }

}
